<?php

namespace App\Http\Controllers\web;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;


class SoftwareController extends Controller
{

    //入口
    public function index(Request $request)
    {
        header('Access-Control-Allow-Origin:*');
        $controller = $request->input('c');
        $action     = $request->input('a');
        $controller = str_replace('/',"\\",$controller);
        $controller = "App\\Http\\Controllers\\".$controller;

        if(!class_exists($controller))
        {
            return "类".$controller."不存在";
        }

        if(!method_exists($controller,$action))
        {
            return "方法".$action."不存在";
        }

        $con        = new $controller();
        return $con->$action($request);
    }
}
